bitkeeper revision 1.1428 (4289c9f6GdUyHEH-FCu9rRuWtOXnXQ)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 17 May 2005 10:39:50 +0000 (10:39 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 17 May 2005 10:39:50 +0000 (10:39 +0000)
Initialise 1:1 mapping of physical memory map early during x86/64 boot.
This mapping should include all ACPI tables, so simplify the mapping
check in the ACPI code.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/acpi/boot.c
xen/arch/x86/e820.c
xen/arch/x86/setup.c
xen/arch/x86/x86_64/mm.c
xen/common/grant_table.c
xen/include/asm-x86/e820.h

index 99fc21b018cc1a1cbbda39589a99e92686c5a338..553a6631c9ffee7cd80cf466c923f0b388eaaa2d 100644 (file)
@@ -40,7 +40,6 @@
 #include <mach_mpparse.h>
 
 int sbf_port;
-#define end_pfn_map max_page
 #define CONFIG_ACPI_PCI
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
@@ -96,12 +95,9 @@ enum acpi_irq_model_id               acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
 {
        if (!phys_addr || !size)
-       return NULL;
-
-       if (phys_addr < (end_pfn_map << PAGE_SHIFT))
-               return __va(phys_addr);
-
-       return NULL;
+               return NULL;
+       /* XEN: We map all e820 areas which should include every ACPI table. */
+       return __va(phys_addr);
 }
 
 #else
index 7c0050185fc3687ca4145ee52397838a9868961c..9749a0eac90eb63824a4c4e424055c0841dca96b 100644 (file)
@@ -372,16 +372,17 @@ static void __init clip_mem(void)
 }
 
 static void __init machine_specific_memory_setup(
-    struct e820entry *raw, int raw_nr)
+    struct e820entry *raw, int *raw_nr)
 {
-    char nr = (char)raw_nr;
+    char nr = (char)*raw_nr;
     sanitize_e820_map(raw, &nr);
+    *raw_nr = nr;
     (void)copy_e820_map(raw, nr);
     clip_4gb();
     clip_mem();
 }
 
-unsigned long __init init_e820(struct e820entry *raw, int raw_nr)
+unsigned long __init init_e820(struct e820entry *raw, int *raw_nr)
 {
     machine_specific_memory_setup(raw, raw_nr);
     printk(KERN_INFO "Physical RAM map:\n");
index cb75477f039be2b1533b77d1726488319f4563ea..49eb0d275bd0e6a81524989b3a0d7cf786d57ffc 100644 (file)
@@ -25,7 +25,7 @@
  * pfn_info table and allocation bitmap.
  */
 static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
-#if defined(__x86_64__)
+#if defined(CONFIG_X86_64)
 integer_param("xenheap_megabytes", opt_xenheap_megabytes);
 #endif
 
@@ -70,7 +70,7 @@ extern int do_timer_lists_from_pit;
 
 struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
 
-#if defined(__x86_64__)
+#if defined(CONFIG_X86_64)
 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE;
 #else
 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE;
@@ -312,10 +312,10 @@ void __init cpu_init(void)
 
     /* Set up and load the per-CPU TSS and LDT. */
     t->bitmap = IOBMP_INVALID_OFFSET;
-#if defined(__i386__)
+#if defined(CONFIG_X86_32)
     t->ss0  = __HYPERVISOR_DS;
     t->esp0 = get_stack_bottom();
-#elif defined(__x86_64__)
+#elif defined(CONFIG_X86_64)
     t->rsp0 = get_stack_bottom();
 #endif
     set_tss_desc(nr,t);
@@ -452,7 +452,7 @@ static void __init start_of_day(void)
 
     watchdog_enable();
 
-#ifdef __x86_64__ /* x86_32 uses low mappings when building DOM0. */
+#ifdef CONFIG_X86_64 /* x86_32 uses low mappings when building DOM0. */
     zap_low_mappings();
 #endif
 }
@@ -519,7 +519,7 @@ void __init __start_xen(multiboot_info_t *mbi)
         for ( ; ; ) ;
     }
 
-    max_page = init_e820(e820_raw, e820_raw_nr);
+    max_page = init_e820(e820_raw, &e820_raw_nr);
 
     /* Find the first high-memory RAM hole. */
     for ( i = 0; i < e820.nr_map; i++ )
@@ -537,11 +537,11 @@ void __init __start_xen(multiboot_info_t *mbi)
         printk("Not enough memory to stash the DOM0 kernel image.\n");
         for ( ; ; ) ;
     }
-#if defined(__i386__)
+#if defined(CONFIG_X86_32)
     memmove((void *)initial_images_start,  /* use low mapping */
             (void *)mod[0].mod_start,      /* use low mapping */
             mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
-#elif defined(__x86_64__)
+#elif defined(CONFIG_X86_64)
     memmove(__va(initial_images_start),
             __va(mod[0].mod_start),
             mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
@@ -562,6 +562,21 @@ void __init __start_xen(multiboot_info_t *mbi)
                             e820.map[i].addr + e820.map[i].size);
     }
 
+#if defined (CONFIG_X86_64)
+    /* On x86/64 we can 1:1 map every registered memory area. */
+    /* We use the raw_e820 map because we sometimes truncate the cooked map. */
+    for ( i = 0; i < e820_raw_nr; i++ )
+    {
+        unsigned long min, sz;
+        min = (unsigned long)e820_raw[i].addr &
+            ~(((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1);
+        sz  = ((unsigned long)e820_raw[i].size +
+               ((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1) &
+            ~(((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1);
+        map_pages(idle_pg_table, PAGE_OFFSET + min, min, sz, PAGE_HYPERVISOR);
+    }
+#endif
+
     printk("System RAM: %luMB (%lukB)\n", 
            nr_pages >> (20 - PAGE_SHIFT),
            nr_pages << (PAGE_SHIFT - 10));
index a1db5acd05d8ccd5fbc0483b9c88c11313a3961a..f3c686750fbf37e0e61e212145e9f71a56ee9ab3 100644 (file)
@@ -128,18 +128,12 @@ void __set_fixmap(
     map_pages(idle_pg_table, fix_to_virt(idx), p, PAGE_SIZE, flags);
 }
 
-
 void __init paging_init(void)
 {
-    unsigned long i, p, max;
+    unsigned long i, p;
     l3_pgentry_t *l3rw, *l3ro;
     struct pfn_info *pg;
 
-    /* Map all of physical memory. */
-    max = ((max_page + L1_PAGETABLE_ENTRIES - 1) & 
-           ~(L1_PAGETABLE_ENTRIES - 1)) << PAGE_SHIFT;
-    map_pages(idle_pg_table, PAGE_OFFSET, 0, max, PAGE_HYPERVISOR);
-
     /*
      * Allocate and map the machine-to-phys table.
      * This also ensures L3 is present for ioremap().
index 591ec609f34fc95f962aaa5e71f14bca1f49fdbe..4bf52e43ff969ecd6f27562523d3f1ee5cd8205d 100644 (file)
@@ -1227,7 +1227,6 @@ grant_table_init(
     void)
 {
     /* Nothing. */
-    DPRINTK("Grant table init\n");
 }
 
 /*
index d774b9a321d6f0dc94bb444ce57b7b62041e8d53..f510c7c12b7e08536551d3decb5e5a1290659512 100644 (file)
@@ -24,7 +24,7 @@ struct e820map {
     struct e820entry map[E820MAX];
 };
 
-extern unsigned long init_e820(struct e820entry *, int);
+extern unsigned long init_e820(struct e820entry *, int *);
 extern struct e820map e820;
 
 #ifndef NDEBUG